﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Enterprise.Infrastructure;
using Enterprise.Model.Article;
using Enterprise.Service.Article;
using Enterprise.Control;
using Enterprise.Service.Module;
namespace Enterprise.UI.Web.Modules.Article
{
    public partial class Disp : System.Web.UI.Page
    {
        int Id = (int)Utility.sink("Id", Utility.MethodType.Get, 0, 0, Utility.DataType.Int);
        protected int ModuleId = (int)Utility.sink("ModuleId", Utility.MethodType.Get, 0, 0, Utility.DataType.Int);
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string s = ModuleService.GetModuleName(ModuleId);
                lb_MName.Text = s;
                OnStart();
                OnCommand();
            }
        }
        private void OnCommand()
        {
            //添加操作按钮
            CreateBT.AddButton("edit.gif", "修改", "Edit.aspx?Moduleid=" + ModuleId + "&Cmd=Edit&Id=" + Id, Utility.PopedomType.Edit, HeadMenu1);
            CreateBT.AddButton("delete.gif", "删除", "Edit.aspx?Moduleid=" + ModuleId + "&Cmd=Delete&Id=" + Id, Utility.PopedomType.Delete, HeadMenu1);
            CreateBT.AddButton("back.gif", "返回", "Index.aspx?ModuleId=" + ModuleId, Utility.PopedomType.List, HeadMenu1);
        }

        private void OnStart()
        {
            ArticleService aService = new ArticleService();
            var q = aService.ArticleDisp(Id);
            if (q != null)
            {
                lb_User.Text = Enterprise.Service.User.UserService.GetUserName(q.AUser);
                lb_Dept.Text = Enterprise.Service.Department.DepartmentService.GetDepartMentName(q.ADepartMent);
                lb_Type.Text = q.AType;
                lb_Title.Text = q.ATitle;
                lb_TitleRu.Text = q.ATitleRu;
                lb_Content.Text = q.AContent;
                lb_ContentRu.Text = q.AContentRu;
            }
        }
    }
}